#function my_function1(){
#	echo "Hello,world!"
#}
#
#my_function2(){
#	echo "Hello,world"
#}
#
#
#my_function1
#
#my_function2

#greet(){
#	echo "Hello,$1! you are $2 years old."
#}
#
#greet "Alice" 25

#count_args(){
#	echo "Number of arguments: $#"
#}
#
#count_args 1 2 3

#add(){
#      result=$(( $1 + $2 ))
#      echo $result
#}
#
#sum=$(add 5 3)
#echo "Sum is : $sum"

#check_positive() {
#    if [ $1 -gt 0 ]; then
#        return 0  # 返回0表示成功
#    else
#        return 1  # 返回1表示失败
#    fi
#}
#
#check_positive 10
#if [ $? -eq 0 ]; then
#    echo "Positive number"
#else
#    echo "Non-positive number"
#fi
#

#example() {
#	local var="I am local"
#	echo $var
#}
#
#example
#
#echo $var


#global_example() {
#    global_var="I am global"
#}
#
#global_example
#
#echo $global_var

#factorial(){
#	if [ $1 -le 1 ]; then
#		echo 1
#	else
#		prev=$(factorial $(( $1 -1)))
#		echo $(( $1 * prev))
#	fi
#}
#
#result=$(factorial 5);
#echo "Factorial of 5 is : $result"


#set -x
#
#example_debug(){
#	echo "This is a debug example"
#	echo "Another line"
#}
#
#example_debug
#
#set +x
#

check_error() {
    if [ $1 -lt 0 ]; then
        echo "Error: Negative number!" >&2
        exit 1
    fi
}

check_error -1 



